import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import model.Usuario;
 
@FacesConverter(value="permissaoConverter")
public class PermissaoConverter implements Converter {
 
    @Override
    public Object getAsObject(FacesContext arg0, UIComponent arg1, String key) {
        FacesContext context = FacesContext.getCurrentInstance();
       // model.Permissao permissao = (model.Permissao) context.getELContext().getELResolver().getValue(context.getELContext(), null, "permissao");
        Usuario usuario = new Usuario();
        model.Permissao permissao = new model.Permissao();
        usuario.setPermissao(permissao);
        return permissao;
    }
 
    @Override
    public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
       if(arg2 != null && arg2 instanceof model.Permissao) {
         return ((model.Permissao)arg2).getPermissao();
         }
         return "";
         }
    }